export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64

GPU_INFO=$(lspci | grep -i nvidia)

# https://developer.nvidia.com/zh-cn/cuda-gpus#compute
if [[ $GPU_INFO == *"GeForce GTX 1060"* ]]; then
    #1060
    GPU_CC=61
elif [[ $GPU_INFO == *"NVIDIA Corporation Device 2684"* ]]; then
    #4090
    GPU_CC=89
elif [[ $GPU_INFO == *"Tesla T4"* ]]; then
    #T4
    GPU_CC=75
elif [[ $GPU_INFO == *"GA100"* ]]; then
    #A100
    GPU_CC=80
elif [[ $GPU_INFO == *"GeForce GTX 1660"* ]]; then
    #1660
    GPU_CC=75
fi
echo $GPU_CC

rm -rf ./build/
mkdir build
cd build
cmake -DGPU_CC=${GPU_CC} ..
make -j20
